package com.maxmlr.music.user.controller;

import com.maxmlr.music.common.bean.ResultBean;
import com.maxmlr.music.user.param.UserInfoParam;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RestController;
import com.maxmlr.music.common.base.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import com.maxmlr.music.user.service.UserInfoService;
import com.maxmlr.music.user.entity.UserInfo;
import io.swagger.annotations.*;
import java.io.Serializable;

/**
 * @author max
 * @version 1.0
 * @ClassName UserInfoController
 * @Description 用户表 控制器
 * @Copyright Copyright (c) 2020: www.maxmlr.com.
 * @since 2020-06-14
 */
@Slf4j
@RestController
@Api(value = "/user/user-info", tags = "UserInfo 控制器")
@RequestMapping("/user/user-info")
public class UserInfoController extends BaseController<UserInfoService, UserInfo> {

    @Autowired
    public UserInfoService service;

    @GetMapping
    public ResultBean<UserInfoParam> getRequestUserInfoParam() {
        return ResultBean.ok(service.getRequestUserInfoParam());
    }

    /**
     * 保存
     *
     * @param dict
     * @return ResultBean<Boolean>
     */
    @PostMapping
    public ResultBean<Boolean> save(UserInfo userInfo) {
        return ResultBean.ok(service.save(userInfo));
    }

    /**
     * 修改
     *
     * @param dict
     * @return ResultBean<Boolean>
     */
    @PutMapping
    public ResultBean<Boolean> update(UserInfo userInfo) {
        return ResultBean.ok(service.updateById(userInfo));
    }

    /**
     * 删除
     *
     * @param id
     * @return ResultBean<Boolean>
     */
    @DeleteMapping("/{id}" )
    public ResultBean<Boolean> remove(@PathVariable("id" ) Serializable id) {
        return ResultBean.ok(service.removeById(id));
    }

}
